package com.itheima.controller;

import com.itheima.domain.db.Freeze;
import com.itheima.service.db.FreezeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/freeze")
public class FreezeController{

    @Autowired
    private FreezeService freezeService;

    @GetMapping("/findFreezeByUserId")
    public Freeze findFreezeByUserId(Integer userId) {
        return freezeService.findFreezeByUserId(userId);
    }

    @PostMapping("/saveFreeze")
    public void saveFreeze(@RequestBody Freeze freeze1) {
        freezeService.saveFreeze(freeze1);
    }

    @PutMapping("/updateFreeze")
    public void updateFreeze(@RequestBody Freeze freeze) {
        freezeService.updateFreeze(freeze);
    }

    @PutMapping("/update")
    public void update(String reasonsForThawing, Integer userId) {
        freezeService.update(reasonsForThawing, userId);
    }

}
